package com.xlh.outside;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.wzm.param.ApiResultPo.LoginReslult;
import com.xlh.Utils.GsonManager;
import com.xlh.adapter.GameServerListAdapter;
import com.xlh.adapter.SettingMainListAdapter;
import com.xlh.bean.SettingItemBean;
import com.xlh.conf.CommonConf;
import com.xlh.interf.IUiUpdateHandler;
import com.xlh.lib.Core.FIntent;
import com.xlh.thread.TestTask;
import com.xlh.view.MyGridView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by mike on 2017-12-19.
 */

public class SettingActivity extends  BaseActivity implements IUiUpdateHandler {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.app_setting_main);
        app = (WzApplication)getApplication();
        bindControl();
        ininControlEvent();

    }


    private void bindControl(){
        cTxtBack = (TextView)findViewById(R.id.setting_txt_title_tag_left);


    }



    @Override
    public Handler getHandler() {
        return null;
    }

    /**
     * 初始化事件
     */
    private void ininControlEvent(){


        cTxtBack.setOnClickListener(new View.OnClickListener(){

            @Override
            public void onClick(View v) {
                FIntent fIntent = new FIntent(SettingActivity.this, ServerListActivity.class);
                startActivity(fIntent);
                finish();
            }
        });


        itemDataList = new ArrayList<SettingItemBean>();
        SettingItemBean item = new SettingItemBean();
        item.setTitle("个人信息");
        itemDataList.add(item);

        item  = new SettingItemBean();
        item.setTitle("单机服务器");
        itemDataList.add(item);

        //填充数据


        gView	=	(MyGridView)findViewById(R.id.setting_gv_item);
        gView.setAdapter(new SettingMainListAdapter(SettingActivity.this,itemDataList));

    }

    public void action(int p){
        String t = itemDataList.get(p).getTitle();
        FIntent fIntent = null;

        if(  t.equals("个人信息") ){
            fIntent = new FIntent(SettingActivity.this, UserInfoActivity.class);
        }else if(t.equals("单机服务器")){
            fIntent = new FIntent(SettingActivity.this, ManagerServerActivity.class);
        }
        startActivity(fIntent);
        finish();
    }





    /**
     * 用户名控件
     */
    private TextView cTxtBack;
    private MyGridView gView;
    private List<SettingItemBean> itemDataList;

    private WzApplication app;




}
